/**
 * Created by Adam on 2017/5/16.
 */
let nextUserId = 1
export const addUser = (name, age) => ({
    type: 'ADD_USER',
    id: nextUserId++,
    name,
    age
})

export const toggleGender = (id) => ({
    type: 'TOGGLE_GENDER',
    id
})

export const setVisibility = (filter) => ({
        type: 'SET_VISIBILITY',
        filter
    }
)

export const login = (username, password) => ({
    type: 'LOGIN_SUCCESS',
    username,
    password
})

export const loginError = (errorMsg) => ({
    type: 'LOGIN_FAILED',
    errorMsg
})

export const logout = () => ({
    type: 'LOG_OUT'
})

export const setRedirectUrl = (redirectUrl) => ({
    type: 'SET_REDIRECT_URL',
    redirectUrl
})

export const toggleSideBar = () => ({
    type: 'TOGGLE_SIDE_BAR'
})